package com.yuanfeng.commoms.exception;

import lombok.EqualsAndHashCode;

/**
 * @Description: 自定义异常
 **/
@EqualsAndHashCode(callSuper = true)
public class DefinedException extends RuntimeException {

    private static final long serialVersionUID = -420925980366951255L;
    /**
     * 异常编号
     */
    private final int messageCode;

    /**
     * 对messageCode 异常信息进行补充说明
     */
    private final String detailMessage;

    public DefinedException(int messageCode, String message) {
        super(message);
        this.messageCode = messageCode;
        this.detailMessage = message;
    }

    public DefinedException(String message) {
        super(message);
        this.messageCode = 5000;
        this.detailMessage = message;
    }

    public int getMessageCode() {
        return messageCode;
    }

    public String getDetailMessage() {
        return detailMessage;
    }
}
